package com.zzyl.redis;


import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
import org.junit.jupiter.api.Test;

public class AIModelTest {
    @Test
    public void Test(){
        // 使用安全认证AK/SK鉴权，替换下列示例中参数，安全认证Access Key替换your_iam_ak，Secret Key替换your_iam_sk，如何获取请查看https://cloud.baidu.com/doc/Reference/s/9jwvz2egb
        Qianfan qianfan = new Qianfan("ALTAKzVhzCwraEkjTvzS8MITnE", "4b8be5e0a879454797376e63ca08db35");

        // 指定模型
        ChatResponse resp = qianfan.chatCompletion()
                .model("ERNIE-4.0-8K-Preview")
                .addMessage("user", "王昌龄吗")
                .execute();
        System.out.println(resp.getResult());
    }
}
